﻿using System;
using System.Linq;
using System.Runtime.InteropServices;
using AfterTheDeadline;

namespace AfterTheDeadlineNet2Adapter
{
    [ComVisible(true)]
    [Guid("82E2FC06-B421-4341-A274-5BD6823F802F")]
    public class AfterTheDeadlineServiceAdapter : IAfterTheDeadlineServiceAdapter
    {
        #region IAfterTheDeadlineServiceAdapter Members

        public void InitService(string applicationKey, string userKey)
        {
            AfterTheDeadlineService.InitService(applicationKey, userKey);
        }

        public IErrorAdapter[] CheckDocument(string data)
        {
            return (from error in AfterTheDeadlineService.CheckDocument(data)
                    select new ErrorAdapter(error)).ToArray();
        }

        public IErrorAdapter[] CheckGrammar(string data)
        {
            return (from error in AfterTheDeadlineService.CheckGrammar(data)
                    select new ErrorAdapter(error)).ToArray();
        }

        public string Info(string text)
        {
            return AfterTheDeadlineService.Info(text);
        }

        public IMetricAdapter[] Stats(string data)
        {
            return (from metric in AfterTheDeadlineService.Stats(data)
                    select new MetricAdapter(metric)).ToArray();
        }

        #endregion
    }
}
